#include "Card.h"

Card::Card() {}

Card::Card(CardPoint point, CardSuit suit)
{
    setPoint(point);
    setSuit(suit);
}

void Card::setPoint(CardPoint point)
{
    m_point = point;
}

void Card::setSuit(CardSuit suit)
{
    m_suit = suit;
}

Card::CardSuit Card::suit() const
{
    return m_suit;
}

Card::CardPoint Card::point() const
{
    return m_point;
}

bool lessSort(const Card &c1, const Card &c2)
{
    //规则：第二个参数比第一个参数大返回真
    if(c1.point() == c2.point()){//点数一样则比较花色
        return c1.suit() < c2.suit();

    }else{//否则比较点数
        return c1.point() < c2.point();
    }
}

bool greaterSort(const Card &c1, const Card &c2)
{
    //规则：第二个参数比第一个参数大返回真
    if(c1.point() == c2.point()){//点数一样则比较花色
        return c1.suit() > c2.suit();

    }else{//否则比较点数
        return c1.point() > c2.point();
    }
}


bool operator ==(const Card &left, const Card &right)
{
    return (left.point()==right.point() && left.suit() == right.suit());
}


uint qHash(const Card &card)
{
    //要求返回每张牌唯一的值
    return card.point() * 100 + card.suit();
}


bool operator <(const Card &left, const Card &right)
{
    return lessSort(left,right);
}

